32-on-64: Fix error path from memory_op() hypercall.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 20 Jun 2007 12:38:22 +0000 (13:38 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 20 Jun 2007 12:38:22 +0000 (13:38 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/compat/memory.c

index 53628d7a35638a21e1aa1e9e11570ba0aa0b6a31..5596c5d73a39845b193d70667372fe72e59c412a 100644 (file)
@@ -258,7 +258,8 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat)
                     compat_pfn_t pfn = nat.rsrv->extent_start.p[start_extent];
 
                     BUG_ON(pfn != nat.rsrv->extent_start.p[start_extent]);
-                    if ( __copy_to_compat_offset(cmp.rsrv.extent_start, start_extent, &pfn, 1) )
+                    if ( __copy_to_compat_offset(cmp.rsrv.extent_start,
+                                                 start_extent, &pfn, 1) )
                     {
                         if ( split >= 0 )
                         {
@@ -275,6 +276,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat)
                         break;
                     }
                 }
+
+                /* Bail if there was an error. */
+                if ( (split >= 0) && (end_extent != nat.rsrv->nr_extents) )
+                    split = 0;
             }
             else
                 start_extent = end_extent;